package method;

public class T4 {
    /*
    * Thread类方法:
    * 1. public String getName(); 获取线程名字
    * 2. public void setName 设置线程名字
    * public static Thread currentThread() 获取当前线程对象
    */
    public static void main(String[] args) {
        Mythread mythread11 = new Mythread();
        Mythread mythread21 = new Mythread();
//        设置线程名字
        mythread11.setName("A:");
        mythread21.setName("B:");
        mythread21.start();
        mythread11.start();
    }
}
class Mythread extends Thread{
    @Override
    public void run() {
        for (int i = 1; i <= 100; i++) {
            System.out.println(getName()+"多线程调用"+i);
        }
    }
}
